<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>商品列表</title>
    <style>
        table,table tr td {
            border-collapse:collapse;
            border:1px solid #000;
        }
    </style>
    <script type="text/javascript" src="/jquery-3.5.1.min.js"></script>
    <script type="text/javascript" src="/util.js"></script>
    <script>
        $(function(){
            /**
             * 秒杀绑定
             */
            toQueryKill();
        });

        function toQueryKill(){
            $("#a_queryKill").click(function(){
                //获取userId
                var  $userId = $("#userId").val();
                if(!$userId){
                    alert("userId不能为空");
                    return;
                }
                var url = "/seckill/list?userId="+$userId;
                window.location.href = url;
            });
        }

    </script>
</head>
<body>

<table border="1">
    <tr>
        <th>序号</th>
        <th>商品名称</th>
        <th>价格：元</th>
        <th>库存</th>
    </tr>
    <tr th:each="goods,goodsStat : ${goodsList}">
        <td th:text="${goods.getGoodsId()}"></td>
        <td th:text="${goods.name}"></td>
        <td th:text="${goods.price}"></td>
        <th th:text="${goods.getStock()}"></th>
    </tr>
</table>

请输入用户id：<br><input type="text"  id="userId"><br>
<a id="a_queryKill" href="javascript:void(0)">查询秒杀</a>


</body>
</html>